package prv.ljw.boot.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by carry on 2017/2/27.
 */
@RestController
public class HelloController {


    @RequestMapping("/hello")
    public String hello(String name){
        return "hello "+name+"!";
    }

    @RequestMapping("/helloHtml")
    public String helloHtml(ModelMap map){
        map.addAttribute("obj","Jianwei");
        return "hello";
    }

    @RequestMapping("/tryError")
    public String tryError() throws Exception {
        throw new Exception("异常管理");
    }

}
